package com.andy.module.network

import com.andy.module.BASE_FC_BEE
import com.andy.module.bean.AppUpdateBean
import com.andy.module.bean.CodeBean
import com.andy.module.network.ApiResponse
import okhttp3.RequestBody
import okhttp3.ResponseBody
import retrofit2.Call
import retrofit2.http.*


/**
 * @creator:LuoFan
 * @date:2022/6/8
 * @description:
 */
interface SimpleApiService {

    companion object {
        const val SERVER_URL = BASE_FC_BEE
    }
    /**
     * 获取升级信息
     */
    @FormUrlEncoded
    @POST
    suspend fun getVersionInfo(@Url url: String, @FieldMap params: HashMap<String, Any>): ApiResponse<AppUpdateBean>


    @FormUrlEncoded
    @POST
    fun getVersionInfoCall(@FieldMap params: HashMap<String, Any>, @Url url: String): Call<ApiResponse<AppUpdateBean>>
    /**
     *
     */
    @FormUrlEncoded
    @POST
    suspend fun postResultAny(@Url url: String, @FieldMap params: HashMap<String, Any>): ApiResponse<Any>

    /**
     * 上传文件
     */
    @Multipart
    @POST
    suspend fun suspendUploadFile(@Url url: String, @PartMap params: HashMap<String, RequestBody>): ApiResponse<String>


    /**
     * 上传文件
     */
    @Multipart
    @POST
    fun uploadFile(@Url url: String, @PartMap params: HashMap<String, RequestBody>): Call<ResponseBody>

    /**
     * 下载文件
     */
    @Streaming
    @GET
    fun downloadFile(@Url url: String): Call<ResponseBody>

    /**
     * 获取config列表
     */
    @FormUrlEncoded
    @POST
    suspend fun getConfigList(@Url url: String, @FieldMap params: HashMap<String, Any>): ApiResponse<MutableList<CodeBean>>
}